const http = require("http");
let data = require("./data.json");
// const url = require("url");

const server = http.createServer((req,res)=>{

    // let obj = url.parse(req,url,true);

    res.setHeader("Content-type","text/html;charset=utf-8");
    let str = "<ul>";
    data.forEach(item=>{
        str += `<li>${item.name}</li>`;
    })
    str +="</ul>"

    res.write(str);
    res.end(); // 告诉浏览器停止请求
})
server.listen(3002)
